package com.hwl.demo6.entity;

/**
 * @author sentry
 * @since 2023-03-18
 */
public class Resume implements Cloneable {
    private final String name;
    private String sex;
    private int age;
    private WorkExperience work;

    public Resume(String name) {
        this.name = name;
        this.work = new WorkExperience();
    }

    /**
     * 设置个人信息
     */
    public void setPersonalInfo(String sex, int age) {
        this.sex = sex;
        this.age = age;
    }

    /**
     * 设置工作经历
     */
    public void setWorkExperience(String timeArea, String company) {
        this.work.setTimeArea(timeArea);
        this.work.setCompany(company);
    }

    /**
     * 展示简历
     */
    public void display() {
        System.out.println(this.name + " " + this.sex + " " + this.age);
        System.out.println("工作经历" + this.work.getTimeArea() + " " + this.work.getCompany());
    }

    @Override
    public Resume clone() {
        Resume object;
        try {
            object = ((Resume) super.clone());
            object.work = this.work.clone();
        } catch (CloneNotSupportedException e) {
            throw new RuntimeException("clone失败");
        }
        return object;
    }
}
